package com.yunhe.common.model.data;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yunhe.common.util.NumberUtil;

import java.util.Date;

public class ElectricityBillDetailCheck implements Comparable<ElectricityBillDetailCheck> {

    private Long id;
    private Long firmCode;
    private Long stationCode;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date date;
    private Double sharpElectricity;
    private Double sharpElectricityCheck;
    private Double peakElectricity;
    private Double peakElectricityCheck;
    private Double flatElectricity;
    private Double flatElectricityCheck;
    private Double valleyElectricity;
    private Double valleyElectricityCheck;
    private Integer type;
    private Double sharpDeviation;
    private Double sharpDeviationRatio;
    private Double peakDeviation;
    private Double peakDeviationRatio;
    private Double flatDeviation;
    private Double flatDeviationRatio;
    private Double valleyDeviation;
    private Double valleyDeviationRatio;

    @Override
    public int compareTo(ElectricityBillDetailCheck o) {
        if (o == null) return 1;
        return this.getDate().compareTo(o.getDate());
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Long getFirmCode() {
        return firmCode;
    }

    public void setFirmCode(Long firmCode) {
        this.firmCode = firmCode;
    }

    public Long getStationCode() {
        return stationCode;
    }

    public void setStationCode(Long stationCode) {
        this.stationCode = stationCode;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Double getSharpElectricity() {
        return sharpElectricity;
    }

    public void setSharpElectricity(Double sharpElectricity) {
        this.sharpElectricity = sharpElectricity;
    }

    public Double getSharpElectricityCheck() {
        return sharpElectricityCheck;
    }

    public void setSharpElectricityCheck(Double sharpElectricityCheck) {
        this.sharpElectricityCheck = sharpElectricityCheck;
    }

    public Double getPeakElectricity() {
        return peakElectricity;
    }

    public void setPeakElectricity(Double peakElectricity) {
        this.peakElectricity = peakElectricity;
    }

    public Double getFlatElectricity() {
        return flatElectricity;
    }

    public void setFlatElectricity(Double flatElectricity) {
        this.flatElectricity = flatElectricity;
    }

    public Double getValleyElectricity() {
        return valleyElectricity;
    }

    public void setValleyElectricity(Double valleyElectricity) {
        this.valleyElectricity = valleyElectricity;
    }

    public Double getPeakElectricityCheck() {
        return peakElectricityCheck;
    }

    public void setPeakElectricityCheck(Double peakElectricityCheck) {
        this.peakElectricityCheck = peakElectricityCheck;
    }

    public Double getFlatElectricityCheck() {
        return flatElectricityCheck;
    }

    public void setFlatElectricityCheck(Double flatElectricityCheck) {
        this.flatElectricityCheck = flatElectricityCheck;
    }

    public Double getValleyElectricityCheck() {
        return valleyElectricityCheck;
    }

    public void setValleyElectricityCheck(Double valleyElectricityCheck) {
        this.valleyElectricityCheck = valleyElectricityCheck;
    }

    public Double getSharpDeviation() {
        return NumberUtil.round(sharpElectricityCheck - sharpElectricity, 2);
    }

    public void setSharpDeviation(Double sharpDeviation) {
        this.sharpDeviation = sharpDeviation;
    }

    public Double getSharpDeviationRatio() {
        return NumberUtil.round(sharpElectricity == 0 ? 0 : (sharpElectricityCheck - sharpElectricity) / sharpElectricity * 100, 2);
    }

    public void setSharpDeviationRatio(Double sharpDeviationRatio) {
        this.sharpDeviationRatio = sharpDeviationRatio;
    }

    public Double getPeakDeviation() {
        return NumberUtil.round(peakElectricityCheck - peakElectricity, 2);
    }

    public void setPeakDeviation(Double peakDeviation) {
        this.peakDeviation = peakDeviation;
    }

    public Double getPeakDeviationRatio() {
        return NumberUtil.round(peakElectricity == 0 ? 0 : (peakElectricityCheck - peakElectricity) / peakElectricity * 100, 2);
    }

    public void setPeakDeviationRatio(Double peakDeviationRatio) {
        this.peakDeviationRatio = peakDeviationRatio;
    }

    public Double getFlatDeviation() {
        return NumberUtil.round(flatElectricityCheck - flatElectricity, 2);
    }

    public void setFlatDeviation(Double flatDeviation) {
        this.flatDeviation = flatDeviation;
    }

    public Double getFlatDeviationRatio() {
        return NumberUtil.round(flatElectricity == 0 ? 0 : (flatElectricityCheck - flatElectricity) / flatElectricity * 100, 2);
    }

    public void setFlatDeviationRatio(Double flatDeviationRatio) {
        this.flatDeviationRatio = flatDeviationRatio;
    }

    public Double getValleyDeviation() {
        return NumberUtil.round(valleyElectricityCheck - valleyElectricity, 2);
    }

    public void setValleyDeviation(Double valleyDeviation) {
        this.valleyDeviation = valleyDeviation;
    }

    public Double getValleyDeviationRatio() {
        return NumberUtil.round(valleyElectricity == 0 ? 0 : (valleyElectricityCheck - valleyElectricity) / valleyElectricity * 100, 2);
    }

    public void setValleyDeviationRatio(Double valleyDeviationRatio) {
        this.valleyDeviationRatio = valleyDeviationRatio;
    }
}
